<template>
	<!-- 添加采购记录 -->
	<view>
		<view class="titlebox">
			<text class="text">采购请求</text>
			<image @click="back()" class="img1" src="../../../static/paimg/返回.png"></image>
		</view>
		<view class="right">
			<view class="item" v-for="(item,index) in optrequest" :key="index" @click="torequest(index)">
				<view class="box">
					<text class="text1">{{item.stoname}}</text>
					<text class="text3">采购编号:{{item.id}}</text>
				</view>
				<view class="box">
					<text class="text2">供应商名称:{{item.supname}}</text>
					<text class="text3">规格:{{item.stospe}}</text>
				</view>
				<view class="box">
					<text class="text2" style="color:#89c58d;">采购数量:{{item.num}}</text>
					<text class="text3">发起人:{{item.whentryname}}</text>
				</view>
				<view class="br"></view>
			</view>
			<text v-if="optrequest.length === 0">暂无数据</text>
		</view>
		<view>
			<drag-button name="新的" :isDock="true" :existTabBar="true" @btnClick="btnClick" />
		</view>
	</view>
</template>

<script>
	import dragButton from '../../../components/drag-button.vue';
	import btnpro from '../../../components/btnpro';
	export default {
		components: {
			btnpro,
			dragButton
		},
		data() {
			return {
				noticeShow: false,
				optrequest:{}
			}
		},
		onLoad() {
			this.getdata();
		},
		methods: {
			async getdata(){
				const res = await this.Request({
					url:'api/procurerequest/getreqdataby',
					method:'POST',
					data:{whether:'未完成'}
				})
				this.optrequest = res.data;
			},
			torequest(e){
				uni.navigateTo({
					url:'/pages/public/procure/procure_request_page?id='+this.optrequest[e].id+'&show=true'
				})
			},
			back(){
				this.BackPage(2);
			},
			btnClick(){
				uni.navigateTo({
					url:'/pages/public/procure/procure_record_add'
				})
			}
		}
	}
</script>

<style lang="scss">
	.titlebox{
		height: 30px;
		display: flex;
		border-bottom: 1px solid #999999;
		background-color: #ffa53d;
		.text{
			margin: auto;
			margin-left: 30px;
			font-weight: 800;
			font-size: 120%;
		}
		.img1{
			margin: auto;
			height: 20px;
			width: 20px;
			margin-left: 200px;
		}
	}
	.right{
		margin-left: 10px;
		.item{
			margin-top: 8px;
			position: relative;
			.br{
				margin-top: 2px;
				height: 1px;
				width: 100%;
				background-color: #999999;
			}
			.box{
				width: 100%;
				.text1{
					font-size: 120%;
					font-weight: 600;
				}
				.text2{
					color: #b7e481;
				}
				.text3{
					width: 130px;
					float:right;
				}
			}
		}
	}
</style>
